﻿using Microsoft.AspNetCore.Mvc;
using PMS.Web.Framework.Controllers;

namespace PMS.Web.Controllers.Frontend
{
    public class HomeController : BaseController
    {
        public HomeController()
        {
        }

        public IActionResult Index()
        {
            //var workflowService = EngineContext.Current.Resolve<IWorkflowMessageService>();
            //workflowService.SendCustomerRegisteredWelcomeEmail(new Data.Entities.Customers.Customer
            //{
            //    Id = 1,
            //    Email = "kmleedavid@qq.com",
            //    LoginName = "kmleedavid",
            //    Mobile = "13388859505",
            //    NickName = "DavidLee",
            //    RequireChangingPwd = false,
            //    RegisteredInStoreId = 1,
            //    IsActive = true,
            //    IsDeleted = false,
            //    CreatedOnTimeUtc = DateTime.UtcNow,
            //    UpdatedOnTimeUtc = DateTime.UtcNow
            //});
            //BaiduWebApiHttpClient client = EngineContext.Current.Resolve<BaiduWebApiHttpClient>();
            //var transResults = client.GetBaiduFanyiResultAsync(new string[] { "中国制造", "内存溢出", ""}).Result;
            //IPAddress loginIp;
            //if(IPAddress.TryParse("118.89.65.15", out loginIp))
            //{
            //    var ipResult = client.GetBaiduIpLocationAsync(loginIp).Result;
            //}
            return View();
        }

        //public IActionResult TestQingStore()
        //{
        //    var client = EngineContext.Current.Resolve<IHttpClientFactory>().CreateClient(HttpDefaultConfigs.DefaultHttpClient);
        //    var fileProvider = EngineContext.Current.Resolve<IPMSFileProvider>();
        //    var filePath = fileProvider.MapPath("~/App_Data/QingStorSettings.json");

        //    //try to get config info from the JSON file
        //    var text = fileProvider.FileExists(filePath)
        //        ? fileProvider.ReadAllText(filePath, Encoding.UTF8)
        //        : string.Empty;
        //    CConfig Config = new CConfig(text, ConfigLoadMode.JsonStr);
        //    CQingStor Service = new CQingStor(Config, "pek3b", client);
        //    //CListBucketsOutput ListBuckets = Service.ListBuckets(null);
        //    //CGetBucketACLOutput bucketacl = Service.Bucket("mcloud", "pek3b").GetACL();
        //    CListObjectsOutput ListObjectsOutput = Service.Bucket("mcloud", "pek3b").ListObjects(null);
        //    // Print the HTTP status code.
        //    // Example: 200
        //    Console.Write(ListObjectsOutput.StatusCode);

        //    // Print the bucket count.
        //    // Example: 5
        //    //Console.Write(ListBuckets.count);
        //    return SuccessJson("", ListObjectsOutput);
        //}

    }
}
